<?php
session_start();
error_reporting(0);
if($_SESSION['username']!="")
{
?>
<!DOCTYPE html>
<html lang="en">
  <head>
     <? include "./include/head.php"; ?>
	  <? include "./include/js.php"; ?>
  </head>
  <body>
  <? include "./include/body.php"; ?>
			<?php
 include "./config/connection.php";
 include "./config/function_thumb.php";
 
 
 $id_pemesanan = $_POST['id_pemesanan'];
 $lokasi_file = $_FILES['foto']['tmp_name'];
 $nama_file   = $_FILES['foto']['name'];

 if(empty($id_pemesanan) || empty($nama_file)){
	header ("location:transfer_add.php?page=input&input=invalid");
 }
 else{	
    $exec="INSERT INTO bukti_pengiriman(id_pemesanan,foto) 
			VALUES('$id_pemesanan',
				  '$nama_file')";
				  

	$sukses_insert = mysql_query($exec);
	if($sukses_insert){
		UploadPengiriman($nama_file);
		echo"<script>alert('Data Berhasil Ditambah ')</script>";
		echo"<script>history.go(-2);</script>";
	}
	else{
		header ("location:transfer_add.php?input=invalid");
	} 
 }

?>
 <? include "./include/menubawah.php"; ?>
    <?php
    ?>
  </body>
</html>
<?php
    }
else {
    include 'warning.php';
}
?>